<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>
			用户管理
		</title>
		<link rel="stylesheet" href="css/content.css" />
		<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
	</head>
	<body>
		<div class="contentStyle">
			<table>
				<thead>
				<tr>
					<td>用户名</td>
					<td>生日</td>
					<td>密保问题</td>
					<td>密保回答</td>
				</tr>
				</thead>
				<tbody>
				  <c:if test="${empty page.data }">
				  <tr> 
				       <td colspan="4">
				        <c:out value="没有数据"></c:out>
				       </td>
				        
				        </tr>
				  </c:if>
				  
				  <c:if test="${!(empty page.data) }">
				     <c:forEach items="${page.data}" var="user">
				        <tr>
					        <td>${user.uname }</td>
							<td>${user.ubirth }</td>
							<td>${user.pwdquestion }</td>
							<td>${user.pwdanswer }学院</td>
						</tr>
				     </c:forEach>
				  </c:if>
					
					
				</tbody>
				
				
				
			</table>
		</div>
		<button onclick="previous()" id="previous">上一页</button> <button id="next" onclick="next()">下一页</button>
		
		<script>
		var currentpage=${page.currentpage};
		if(currentpage==1){
			$("#previous").attr("disabled","disabled");
		} else{
			$("#previous").removeAttr("disabled");
		}
		
		var endpage=${page.pagesum};
		if(currentpage==endpage){
			$("#next").attr("disabled","disabled");
		}else{
			$("#next").removeAttr("disabled");
		}
		
		
		function previous(){
			var currentpage=${page.currentpage};
			if(currentpage==1){
				window.location.href="list.user?n="+currentpage;
			}else{
				window.location.href="list.user?n="+(currentpage-1);
			}
		}
		
        function next(){
			var endpage=${page.pagesum};
			var currentpage=${page.currentpage};
			if(currentpage==endpage){
				window.location.href="list.user?n="+currentpage;
			}else{
				window.location.href="list.user?n="+(currentpage+1);
			}
			
		}
		
		</script>
	</body>
</html>
